<template>
    <div>
        会员名称<input type="text" v-model="que.hymc"> 
       年龄范围 <input type="text"v-model="que.min">-
     <input type="text"v-model="que.max">
     会员打架<select v-model="que.dj">
                            <option value="">请选择</option>
                            <option value="黄金">黄金</option>
                            <option value="白银">白银</option>
                            <option value="青铜">青铜</option>
                            <option value="王者">王者</option>
                        </select>
     <input type="button" value="查询" @click="add">
     <a href="https://localhost:7267/api/hy/dc">导出</a>

        <table class="table">
            <thead>
                <tr>
                    <td>会员名称</td>
                    <td>会员等级</td>
                    <td>会员性别</td>
                    <td>上传头像</td>
                    <td>年龄</td>
                    <td>会员状态</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <tr v-for="m in data">
                    <td>{{m.hymc}}</td>
                    <td>{{m.hydj}}</td>
                    <td>{{m.hyxb}}</td>
                    <td>
                        <img :src="'https://localhost:7267/'+m.hydz" style="width: 60px;height: 60px;">
                    </td>
                    <td>{{m.nl}}</td>
                    <td>{{m.hyzt?"启用":"禁用"}}</td>
                    <td>
                        <input type="button" value="修改" @click="xg(m.hyid)">
                        <input type="button" value="禁用" @click="">

                    </td>
                </tr>
            </tbody>
        </table>
        <input type="button" value="首页" @click="page(1)">
        <input type="button" value="上一页" @click="page(2)">
        <input type="button" value="下一页" @click="page(3)">
        <input type="button" value="尾页" @click="page(4)">


        
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref,onMounted } from 'vue';
import { useRouter } from 'vue-router';

const stro=useRouter();


const data=ref([{
    "hyid": 0,
  "hymc": "string",
  "hydj": "",
  "hyxb": "string",
  "hydz": "string",
  "nl": 0,
  "hyzt": true
}])
 
const xg=(a:any)=>{
    stro.push({path:"/hyxg",query:{hyid:a}})
}
const page=(a:any)=>{
    if(a==1){
        que.value.index=1;
        add();
    }
    if(a==2){
        if(que.value.index>1){
            que.value.index-=1;
            add();
        }
   
    }
    if(a==3){
        if(que.value.index<quer.value.plist){
            que.value.index+=1;
        add();
        }
     
    }
    if(a==4){
        que.value.index=quer.value.plist;
        add();
    }
}

const que =ref({
    index:1,
    page:3,
    hymc:"",
    max:null,
    min:null,
    dj:""
})

const quer = ref({
    count:0,
    plist:0,
})
onMounted(()=>{
    add();
})
 const add=()=>{
  stro.push({path:"/dl"})
 }

</script>

<style scoped>

</style>